#ifndef NODE_H_
#define NODE_H_

#include "types.h"
#include "module.h"
#include "../kernel/include/kernel/manifold.h"
#include "../kernel/include/kernel/component.h"

using namespace std;


class Node: public manifold::kernel::Component
{
public:
    int nodeID;
    map<module_t, Module*> mod;
    map<module_t, manifold::kernel::CompId_t> mod_cid;
    
    struct core_t *core;
    bool has_mc;
    

    Node (int nodeID);
    ~Node ();

    void build_1Level_MESI_node (Module *NI);
    void build_1Level_MOESI_node (Module *NI);
    void build_2Level_FULL_REP_MESI_node (Module *NI);
    void build_2Level_FULL_REP_MOESI_node (Module *NI);
    void build_2Level_SELECT_REP_MESI_node (Module *NI);
    void build_2Level_SUPERDOME_MOESI_node (Module *NI);
    void add_MC_to_node ();

    void build_manifold_node (manifold::kernel::CompId_t NI_cid);
    void manifold_connect ();
    void add_MC_to_manifold_node ();
    
    void tick (void);
    void tock (void);
};

#endif /* NODE_H_ */
